package com.lee.pullrefresh.http;

import org.json.JSONException;

import android.text.TextUtils;
import android.util.Log;

public class ZModelTask extends HttpTaskRunner {

	public ZModelTask() {
	}

	// request
	public String mAction;

	// response
	public int mResult;
	public String mHelpMessage;

	public boolean responseSuccess() {
		if (CODE_OK == mOpCode) {
			return true;
		}
		return false;
	}

	@Override
	public void parse(String responseContent) throws JSONException {
		if (!TextUtils.isEmpty(responseContent)) {
			JSONObjectProxy obj = new JSONObjectProxy(responseContent);
			try {
				String code = obj.getString("code"); 
				String data = obj.getString("data");
				String message = obj.getString("message");
				
			try {
				mResult = Integer.valueOf(code);
				Log.i("mResult", "mResult : "+mResult);
			} catch (Exception e) {
				mResult = -1;
			}
			try {
				mHelpMessage = message;
				Log.i("mHelpMessage", "mHelpMessage : "+mHelpMessage);
			} catch (Exception e) {
				mHelpMessage = null;
			}
			parseData(data);
			} catch (Exception e) {
				// TODO: handle exception
			}
		} 
	}

	public void parseData(String data) throws JSONException {}

	
	public void parseExceptVariablesData() {
	}
}
